<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of cmain
 *
 * @author Administrator
 */
class Cmain extends Controller {

    //put your code here
    //2.) funtion vJoinUs()

    function vJoinUs() {
        $arrData = array();
        $this->load->Model('mcommon', 'mcomm');

        $cmd = $this->input->post('cmd');
        if ($cmd == "Add") {
            $arrInput = array(
                'name' => $this->input->post('txtName')
                , 'weight' => $this->input->post('txtWeight')
                , 'height' => $this->input->post('txtHeight')
                , 'birthday' => $this->input->post('txtBirhtDay')
            );

            if (!$this->mcomm->addData('profile', $arrInput)) {
                log_message('info', "Can't insert data ");
            }
            $arrData['v1'] = array('tttt'=> 'aaa');

        }
        
        
        $this->session->set_userdata('mdata_content', $arrData);
        $this->session->set_userdata('mfile_content', 'vJoinUs.tpl');
        $this->index();
    }

    // 1.)main
    function index() {

        if (!$this->session->userdata('pagetop')) {
            $this->session->set_userdata('pagetop', array());
        }
        print_r($this->session->userdata('mfile_content'));
        if($this->session->userdata('mfile_content') == ""){
            $this->session->set_userdata('mfile_content', 'vInfo.tpl');
        }

        $viewAssign = array('notice' => $this->session->userdata('noticeMess')
            , 'pageTop' => $this->session->userdata('pagetop')
            , 'title' => 'Bedict.com'
            , 'stitle' => $this->session->userdata('stitle')
            , 'loginInfo' => $this->session->userdata('loginInfo')
            , 'mdata_content' => $this->session->userdata('mdata_content')
            , 'mfile_content' => $this->session->userdata('mfile_content')
        );
        $this->load->library('cismarty');
        $this->cismarty->assign('baseUrl', base_url());
        $this->cismarty->assign('vassign', $viewAssign);
        $this->cismarty->display('vMain.tpl');
    }

    function Cmain() {
        parent::Controller();
    }

}

?>
